import logging
import redis


class Config(object):
    SQLAlCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/pyinfo'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    #2.1配置Redis
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    #4.0生成随机数
    SECRET_KET = '1egY3wXpn8FO/cUlP+s+aBB1D1Ct38sqrGdHDAFmUG1qELJzXxu5d4zZTvxAbj1L/0Hw7EJVUxgmvNy/oYs='
    #4.2配置flask-session扩展
    SESSION_TYRE = 'redis'#设置同步信息
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    SESSION_USE_SIGNER = True #开启签名,保证数据安全
    PERMANENT_SESSION_LIFETIME = 86400*7 #配置国企时间
    #5.0


class DevelopmentConfig(Config):
    """开发模式下的配置"""
    DEBUG = True
    LOG_LEVEL = logging.DEBUG

class ProductionConfig(Config):
    """生产模式下的配置"""
    DEBUG = False
    LOG_LEVEL = logging.WARNING